﻿function initMenu(id,menuid) {
    $.ajax({
        type: "get",
        url: baseUrl + "GetMenuListByParentID&timestamp=" + new Date().getTime(),
        async: false,
        data: { ParentID: menuid },
        success: function (result) {
            // console.log(result);
            if (result != "") {
                if (result.indexOf("超时") != -1) {
                    alert("用户登录信息已过时,请重新登录！");
                    window.location.href = "../basic/login.html";
                } else {
                    $(id).html(result);
                }
            } else {
                layer.msg("没有该菜单权限")
            }
        },
        error: function (XMLHttpRequest, textStatuss, errorThrown) {
            document.write(XMLHttpRequest.responseText);
        },
        beforeSend: function (xmlHttp) {
            xmlHttp.setRequestHeader("If-Modified-Since", "0");
            xmlHttp.setRequestHeader("Cache-Control", "no-cache");
        }
    })
}
$(function () {
    if (window.location.href.indexOf("basic/login.html") == -1) {
        if (!localStorage.getItem("UserID")) {
            window.location.href = "../basic/login.html";
        }
    }
})